import QtQuick
import QtQuick.Layouts
import Qt5Compat.GraphicalEffects

Item {
  id: root
  // 神威震乾坤.BB
  // 素材列表：逐帧的背景x1

  //property int sceneHeight: 720
  //property int sceneWidth: 1280
  property string img: "../image/anim/shenweizhengqiankun/shenweizhengqiankun-play_"

  anchors.fill: parent
  scale: 0.75
  //Image {source:"/home/notify/Pictures/壁纸/2de96144883411ebb6edd017c2d2eca2.png"}
  Rectangle {
    id: mask
    scale: 1 / 0.75
    color: "black"
    anchors.fill: parent
    opacity: 0.7
  }

  Image {
    id: bg
    anchors.centerIn: parent
    anchors.verticalCenterOffset: -parent.height * 0.12
    property int curr: 1
    scale: 0.8
    source: img + curr + ".png"
    opacity: 0
  }

  // 动画效果：持续2200ms
  // -----
  // 背景从原大小放大到1.2倍; 200 ms
  // -----
  // 背景逐帧播放 ; 2000 ms
  // -----
  // 关闭动画 ; 300 ms

  ParallelAnimation {
    id: step1
    running: false
    // bg
    PropertyAnimation {
      target: bg
      property: "scale"
      to: 1.6
      duration: 50
      easing.type: Easing.InQuad
    }
    PropertyAnimation {
      targets: bg
      property: "opacity"
      to: 1
      duration: 50
      easing.type: Easing.InQuad
    }

    onFinished: {
      step2.start();
    }
  }

  ParallelAnimation {
    id: step2
    running: false

    PropertyAnimation {
      target: bg
      property: "curr"
      to: 79
      duration: 3000
    }

    SequentialAnimation {
      PauseAnimation {
        duration: 3000
      }

      PropertyAnimation {
        target: root
        property: "opacity"
        to: 0
        duration: 300
      }
    }

    onFinished: {
      roomScene.bigAnim.source = "";
    }
  }

  Component.onCompleted: {
    step1.running = true;
  }
}
